/************************新后台js*********************************/
define(function(require) {
	
	var $ = require('jquery1.7');
	var utils = require("utils");
	var ctx = utils.constants.ctx;

	var internalEmailService = require("bean/internalEmailService");
	var Confirmbox = require("confirmbox");
	var Validator = require("validator");
	
	var BlackBox = require("blackbox");
	var blackBox = new BlackBox();
	
	var loginUserId=$("#loginUserId").val();
	
	$(function(){
		var inx = $(".p_isRead").length;
		for(var i=0;i<inx;i++){
			var id = $(".p_isRead").eq(i).parent().attr("data");
			var result = internalEmailService.isReadById(id);
			$(".p_isRead").eq(i).html(result);
		}
	});
	
	$(".p_emailDetail").bind("click",function(){
		var id=$(this).parent().attr("data");
		internalEmailService.isOrNoRead(id,loginUserId);
		location.href = ctx +"/back/website/emailDetail?emailId="+id;
	});
	
	//查看邮件详细信息
	$(".checkEmailDetail").click(function(){
		var id = $(this).parent().parent().parent().attr("data");
		internalEmailService.isOrNoRead(id,loginUserId);
		location.href = ctx + "/back/website/emailDetail?emailId="+id;
	});
	
	$(".deleteEmail").bind("click",function(){
		var id = $(this).parent().parent().parent().attr("data");
		blackBox.confirm('确认删除？',function(data){
			if(data){
			internalEmailService.emailDelete(id,loginUserId);
			location=location;
			}
		},{
			title:'提示',
			value:'确认'
		});
	});
		
});



